/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 徐海涛
 * Date: 2021-11-23
 * Time: 20:21
 */
class Person {
    public static int count = 0;//static静态变量-》类变量
    public String name;//字段—》属性-》成员变量-》
    public int age;//字段-》属性-》-》成员变量
    public void eat() {
        System.out.println(name + "正在吃饭");
    }
    public void sleep() {//方法变量
        System.out.println(name + "正在睡觉");
    }
}
class main {
    public static void main1(String[] args) {
        Person person = new Person();//类的实例化-->创建对象
        person.age++;
        person.count++;
        System.out.println("person.age=" + person.age);
        System.out.println("person.count=" + person.count);
        Person person1 = new Person();
        person1.age++;
        person1.count++;
        System.out.println("person1.age=" + person1.age);
        System.out.println("person1.count=" + person1.count);
    }
}


class Test {
    public String name = "wyz";
    public int age = 21;
}
class main1 {
    public static void main(String[] args) {
        Test test = new Test();
        System.out.println(test.age);
        System.out.println(test.name);
    }
}
class Demo {
    private String name = "wxl";
    private int age = 21;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}
class Main2 {
    public static void main(String[] args) {
        Demo demo = new Demo();
        System.out.println(demo.getName() + "的年龄是: " + demo.getAge());
        demo.setName("xht");//进行修改
        demo.setAge(33);
        System.out.println(demo.getName() + "的年龄是 " + demo.getAge());
    }
}





public class TestDemo {
}
